//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.discount;

import java.awt.Font;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

public class PopupDiscountGUI extends JPopupMenu {

    public PopupDiscountGUI() {
        newLinesMI = null;
        insertLineMI = null;
        deleteLineMI = null;
        initialize();
    }

    public PopupDiscountGUI(String label) {
        super(label);
        newLinesMI = null;
        insertLineMI = null;
        deleteLineMI = null;
    }

    private void initialize() {
        add(getDeleteLineMI());
    }

    private JMenuItem getNewLinesMI() {
        if (newLinesMI == null) {
            newLinesMI = new JMenuItem();
            newLinesMI.setText("Nouvelles lignes");
            newLinesMI.setFont(new Font("Tahoma", 1, 11));
        }
        return newLinesMI;
    }

    private JMenuItem getInsertLineMI() {
        if (insertLineMI == null) {
            insertLineMI = new JMenuItem();
            insertLineMI.setText("S\351l\351ctionner une r\351f\351rence");
            insertLineMI.setFont(new Font("Tahoma", 1, 11));
        }
        return insertLineMI;
    }

    private JMenuItem getDeleteLineMI() {
        if (deleteLineMI == null) {
            deleteLineMI = new JMenuItem();
            deleteLineMI.setText("Suprimer une ligne");
            deleteLineMI.setFont(new Font("Tahoma", 1, 11));
        }
        return deleteLineMI;
    }

    public JMenuItem getNewLines() {
        return getNewLinesMI();
    }

    public JMenuItem getInsertLine() {
        return getInsertLineMI();
    }

    public JMenuItem getDeleteLine() {
        return getDeleteLineMI();
    }
    private JMenuItem newLinesMI;
    private JMenuItem insertLineMI;
    private JMenuItem deleteLineMI;
}
